package com.fairytask.utils
{
	import flash.utils.getTimer;

	/**
	 * 时间管理类 
	 * @author game
	 * 
	 */	
	public class TimeUtil
	{
		private var _lastTime:uint = 0;
		private var _curTime:uint = 0;
		private var _dt:Number = 0; //共过了多少时间
		
		public function TimeUtil()
		{
		}
		
		public function get dt() : Number
		{
			return _dt;
		}
		
		public function update() : void
		{
			_curTime = getTimer();
			_dt = (_curTime - _lastTime) * 0.001;
			_lastTime = _curTime;
		}
		
		/**
		 * 记录消耗的时间 
		 * @return 
		 * 
		 */
		public function get elapsed() : uint
		{
			return _curTime;
		}
	}
}